package com.xinwei.leetcode.二叉树;
// https://leetcode-cn.com/problems/invert-binary-tree/
public class _226_翻转二叉树 {
    // 无非就是在遍历二叉树时交换左右子树
    public TreeNode invertTree(TreeNode root) {
        if (root == null) return null;

        invertTree(root.left);
        invertTree(root.right);

        TreeNode tmp = root.left;
        root.left = root.right;
        root.right = tmp;

        return root;
    }
}
